package o;

import java.util.HashMap;
import java.util.Map;

public class bhj {
    private static Map<String, Class<? extends bgz>> ˎ = new HashMap();

    public static void ˊ() {
        ˏ("html", bhc.class);
    }

    private static void ˏ(String str, Class<? extends bgz> cls) {
        ˎ.put(str, cls);
    }

    public static bgz ˋ(String str) {
        if (str == null) {
            return null;
        }
        Class cls = (Class) ˎ.get(str);
        if (cls == null) {
            int indexOf = str.indexOf(124);
            if (indexOf != -1) {
                str = str.substring(0, indexOf);
            }
            cls = (Class) ˎ.get(str);
        }
        if (cls != null) {
            try {
                return (bgz) cls.newInstance();
            } catch (Throwable e) {
                Logger.ˋ("SegmentRegister", "InstantiationException, e: ", e);
            } catch (Throwable e2) {
                Logger.ˋ("SegmentRegister", "IllegalAccessException, ex: ", e2);
            }
        }
        return null;
    }
}
